/*
 * Copyright 2006-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Copyright 2007 MartiniMix.net
 */
package net.martinimix.edesk.search;

import com.bluemartini.dna.BMException;
import com.bluemartini.dna.DNAList;
import com.bluemartini.dna.DNAStringArray;
import com.bluemartini.server.BusinessAction;

/**
 * Provides a business action that returns all searchable attributes,
 * currently none.  By default, no searchable attrbutes are returned
 * as this feature is not really necessary with Endeca.
 * 
 * @author Scott Rossillo
 *
 */
public class GetSearchableAttributes extends BusinessAction {

	
	/**
	 * Returns an array of searchable attributes.  This implementation returns
	 * an empty array.
	 * 
	 * @return a <code>DNAStringArray</code> containing the names of searchable
	 * attributes; or an empty <code>DNAStringArray</code> if no attributes are
	 * searchable
	 */
	protected DNAStringArray prepareSearchableAttributeArray () {
		return  new DNAStringArray();
	}
	
	/**
	 * Returns a <code>DNAList</code> containing the <code>SEARCHABLE_ATTRIBUTE_ARRAY</code>
	 * <code>DNAStringArray</code>.
	 * 
	 * @see com.bluemartini.server.BusinessAction#execute(com.bluemartini.dna.DNAList)
	 * @see #prepareSearchableAttributeArray()
	 */
	public final DNAList execute(DNAList dnaIn) throws BMException {
		
		final DNAList response = new DNAList();
		
		response.setStringArrayRef("SEARCHABLE_ATTRIBUTE_ARRAY", prepareSearchableAttributeArray());
		
		return response;
	}

}
